package com.joven.shelltest.utils.obersever;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 变体 替代 WeatherData
 * @Author wzj
 * @Date 2023-09-19 10:32
 **/
@Slf4j
@Component
public class SubjectFactory {

    @Autowired(required = false)
    private List<Observer> observers;


    public void processing(float temperature, float pressure, float humidity) {
        for (Observer observer : observers) {
            observer.update(temperature, pressure, humidity);
        }
    }
}
